package com.lottery.football.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.lottery.football.pojo.Dopester;
import com.lottery.football.service.DopesterService;

@Controller
@RequestMapping("/dopester")
public class DopesterController 
{
	@Resource(name="dopesterService")
	private DopesterService dopesterService;
	
	@RequestMapping("/list.html")
	public ModelAndView list()
	{
		return new ModelAndView("/dopester/list");
	}
	
	@RequestMapping("/add.do")
	public ModelAndView toAddPage()
	{
		return new ModelAndView("/dopester/addDopester");
	}
	
	@RequestMapping(value = "/ajax/add.do", method = RequestMethod.POST)
	@ResponseBody  
	public Map<String, String> addDopester(@RequestBody Dopester dopester)
	{
		dopesterService.insert(dopester);
		Map<String, String> map =new HashMap<String, String>();
		map.put("msg", "success");
		return map;
	}
}
